package tw.com.diray;

import android.app.Activity;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

public class CalendarActivity extends Activity {

	private final static int WRITE_CODE = 0001;

	private String yyyymmdd = "";

	private TextView ttitle = null;

	private DatePickerDialog dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_calendar);

		this.ttitle = (TextView) this.findViewById(R.id.yyyymmdd);

	}

	/**
	 * 到寫文章畫面
	 * 
	 * @param view
	 */
	public void writeBook(View view) {

		Intent writeIntent = new Intent(CalendarActivity.this,
				CalendarWriteActivity.class);

		Bundle bundle = new Bundle();
		bundle.putString("yyyymmdd", yyyymmdd);
		writeIntent.putExtras(bundle);
		startActivityForResult(writeIntent, WRITE_CODE);
	}

	public void clckDate() {

		dialog.show();
	}

	@Override
	public boolean onCreateOptionsMenu(android.view.Menu menu) {
		getMenuInflater().inflate(R.menu.dairy_calendar, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		final int id = item.getItemId();
		switch (id) {

		case R.id.action_settings:
			this.clckDate();
			return true;
		}
		return false;
	}
}
